package org.xxpay.pay.channel.zypay;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

/**
 * @author: pangxiaoyu
 * @date: 2019年8月21日14:31:44
 */
@Component
public class ZypayConfig {

    public static final String CHANNEL_NAME = "zypay";
    public static final String CHANNEL_NAME_PAY = CHANNEL_NAME + "_pay";        // 统一支付

    public static final String RETURN_VALUE_OK = "OK";
    public static final String RETURN_VALUE_FAIL = "FAIL";

    // 商户账号
    private String mchId;
    // key
    private String key;
    // 请求地址
    private String reqUrl;
    // 银行编码
    private String bankCode;
    // 模式 form | sdk | url
    private String mode;

    public ZypayConfig(){}

    public ZypayConfig(String payParam) {
        Assert.notNull(payParam, "init "+CHANNEL_NAME+" config error");
        JSONObject object = JSONObject.parseObject(payParam);
        this.mchId = object.getString("mchId");
        this.key = object.getString("key");
        this.reqUrl = object.getString("reqUrl");
        this.bankCode = object.getString("bankCode");
        this.mode = object.getString("mode");
    }

    public String getMchId() {
        return mchId;
    }

    public void setMchId(String mchId) {
        this.mchId = mchId;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getReqUrl() {
        return reqUrl;
    }

    public void setReqUrl(String reqUrl) {
        this.reqUrl = reqUrl;
    }

    public String getBankCode() {
        return bankCode;
    }

    public void setBankCode(String bankCode) {
        this.bankCode = bankCode;
    }

    public String getMode() {
        return mode;
    }

    public void setMode(String mode) {
        this.mode = mode;
    }
}
